<?php
$this->pageTitle = CHtml::encode($article->title);

//$category_link = CHtml::link($article->cat->name, url("/content/blog", array("id" => $article->cat->id, "alias" => CHtml::encode($article->cat->alias))));
$category_url = url("/content/blog", array("id" => $article->cat->id, "alias" => CHtml::encode($article->cat->alias), 'lang' => Yii::app()->session['lang']));
$this->breadcrumbs = array(t('MODULE_NAME','content'), CHtml::encode($article->cat->name) => $category_url,  CHtml::encode($article->title));
?>
<div class="component_heading">
    <h1><?php echo CHtml::encode($article->title) ?></h1>
</div>
<div class="component_info">
    <strong><?php echo t('LBL_CATEGORY','content')?>: </strong><?php echo CHtml::link($article->cat->name, $category_url); ?> <br/>
    <strong><?php echo t('LBL_UPDATE_DATE','content')?>: </strong><?php echo $article->update_date ?>
</div>
<div class="component_content">
    <?php echo CHtml::encode($article->introtext) ?>
    <?php echo CHtml::encode($article->fulltext) ?>
</div>

<?php if ($article->can_comment): ?>
    <div class="comment_header"><h1><?php echo t('LBL_COMMENT','content')?>:</h1></div>
    <div class="component_comment">
        <?php foreach ($comment_list as $item): ?>
            <div class="comment_item">
                <h1><?php echo $item->created_by ?></h1>
                <div class="comment_date"><?php echo $item->create_date; ?></div>
                <div class="comment_text"><?php echo $item->comment_text; ?></div>
            </div>
        <?php endforeach; ?>
    </div>
    <div class="comment">
        <h1><?php echo t('LBL_COMMENT_VIEW','content')?></h1>
        <?php if (Yii::app()->user->hasFlash('success')): ?>
            <div class="flash-success">
                <?php echo Yii::app()->user->getFlash('success'); ?>
            </div>
        <?php elseif (Yii::app()->user->hasFlash('failure')): ?>
            <div class="flash-error">
                <?php echo Yii::app()->user->getFlash('failure'); ?>
            </div>
        <?php endif; ?>
        <?php
        $form = $this->beginWidget('CActiveForm', array(
            'id' => 'article-form',
            'enableAjaxValidation' => false,
            'enableClientValidation' => true,
            'clientOptions' => array('validateOnSubmit' => true, 'validateOnType' => true),
            //'action' => url('/content/savecomment'),
                ));
        ?>
        <table style="width: 100%">
            <tr>
                <td class="label required" width="75px" ><?php echo t('LBL_COMMENT_SUBMIT_BY','content')?> <span>*</span></td>
                <td class="input" >
                    <?php echo $form->hiddenField($comment, "article_id", array('value' => $article->id)) ?>
                    <?php echo $form->textField($comment, 'created_by', array('style' => 'width:100%')); ?>
                    <?php echo $form->error($comment, 'created_by'); ?>
                </td>
            </tr>
            <tr>
                <td class="label required" colspan="2"><?php echo t('LBL_COMMENT_TEXT','content')?> <span>*</span>
                    <?php echo $form->error($comment, 'comment_text'); ?>
                </td>
            </tr>
            <tr>
                <td class="inputr" colspan="2">
                    <?php echo $form->textArea($comment, 'comment_text', array('rows' => '10')); ?>
                </td>
            </tr>
            <tr>
                <td colspan="2" class="cbutton">
                    <?php echo Html::submitButton(t('BTN_COMMENT_SUBMIT','content')); ?>
                    <?php //echo CHtml::button('Submit comment',array('id'=>'btnSubmit')); ?>
                </td>
            </tr>
        </table>
        <?php $this->endWidget(); ?>
    </div>
<?php endif ?>
<script type="text/javascript">
    $(document).ready(function(){
        //alert(1);
    });
</script>